package academic.emailClient.control.listeners;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import academic.emailClient.model.EmailClientModel;
import academic.emailClient.view.EmailClientViewInterface;

/**
 * Class tell the view that whenever an action to do one 
 * of the following "cancel, save to draft, save to To send, send button" 
 * is clicked how to execute .And the action performed for each of which
 * is calling a new instance of the related class..
 *  
 * * @author 
 *
 */
public class ManageTemplatesActionListener implements ActionListener{
	
	private EmailClientViewInterface view;
	private EmailClientModel model;
	
/**
 * constructor
 * 	
 * @param view
 * @param model
 */
	public ManageTemplatesActionListener(EmailClientViewInterface view, EmailClientModel model) {
		super();
		this.view = view;
		this.model = model;
	}

	/**
	 * Handle Manage Template Button Action event
	 */
	@Override
	public void actionPerformed(ActionEvent e) {
		view.showManageTemplates();
		try {
			view.addModifyTemplateCbListener(new ModifyTemplateComboBoxChangedListener(view, model));
		} catch (Exception e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		
		view.addTabChangedActionListener(new TabbedPaneChangedListener(view, model));		
	}
	
	

}
